home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / dcd.zip / dcd / dcd.doc < prev   
Text File  |  1997-08-11  |  13KB  |  248 lines

  1. ==============================================================================
  2. Disk Change Directory v2.00                      (c) Roger de Reus 11-AUG-1997
  3. ==============================================================================
  4. DCD (disk  change directory) is yet another  smart change directory.   You ask
  5. why?  Well,  because I could not  find a program which does  what I want.  So,
  6. here is my version, which I donate  to the public  domain.  The package may be
  7. distributed freely in its entirety only (i.e., you  should have received three
  8. files: dcd.cmd, dcd.doc, and dcd.diz).  Changes to  the code are allowed under
  9. condition that the files are saved under another name and clearly documented. 
  10.  
  11. Disclaimer: DCD.CMD is supplied on an as-is basis.  The author of this program
  12.             is not  responsible for any damage (loss  of  data etc.) caused by
  13.             the  (mis)use  of  this  program.    No claim  as   to  the proper
  14.             functioning  of this program  is made  (although I  do my best, of
  15.             course). Usage at your own risk.
  16.  
  17. OK, let's get down to it. 
  18.  
  19.  
  20. INSTALLATION. 
  21.  
  22. DCD.CMD requires OS/2  and REXX and should  be located somewhere on your path.
  23. First you build a file DCD.LST which contains the  directory structure of your
  24. drives.  This file  will be placed in  the same directory  as where DCD.CMD is
  25. located.  (If you saved DCD.CMD under another name, say MYCD.CMD, a file named
  26. MYCD.LST will be created.  Alternate list files can be  specified as well, see
  27. later.)   Then you can  use DCD  to hop  around  from one directory to another
  28. across drives  ad libitum.   Optionally, (GNU's) grep.exe can be used to match
  29. wildcards in directory names. 
  30.  
  31.  
  32. USAGE. 
  33.  
  34.   DCD [-?|-help] [-scan|-rescan <drives>] [-option] <-n>|<[dir]> 
  35.  
  36. The "[dir]" part  of the input  is required when  you want to  move to another
  37. directory. [dir] is the partial or full directory name.  The input may contain
  38. leading as well  as trailing blanks, drive  letters,  path names, and  regular
  39. expressions.   When the input is of  the form -n  (with n a positive integer),
  40. you will be brought n levels up in the directory tree. 
  41.  
  42. Examples: 
  43.  
  44.    dcd c:\foo    match occurrences of "\foo" on drive "c:" 
  45.    dcd fo        match occurrences of "fo" on current drive 
  46.    dcd foo       match occurrences of " foo" on current drive 
  47.    dcd foo bar   match occurrences of " foo bar" on current drive 
  48.    dcd foo\bar   match occurrences of "foo\bar" on current drive 
  49.    dcd d:..\..   go to `grandparent' of current directory on drive "d:" 
  50.    dcd -2        go up two levels in directory tree 
  51.    dcd e:        change to drive "e:" 
  52.    dcd %home%    change to directory set by environment variable "home" 
  53.  
  54.  
  55. OPTIONS. 
  56.  
  57. The  default behavior  of DCD   can be changed  by   using options.  Arguments
  58. starting `-' or `/' are recognized as options.  Options may be abbreviated and
  59. are  not case sensitive.   Options  and their  arguments  are separated by the
  60. blank character.  Full list of options (the capitalized part of the options is
  61. the minimum required to recognize the option): 
  62.  
  63.    -?             short help
  64.    -Help          long help
  65.    -Global        global change directory: match directories on all drives
  66.    -Local         local change directory: stay on current drive (default)
  67.    -SElect        user select mode: query for multiple matches (default)
  68.    -Next          round-robin mode: do not query, jump to next match
  69.    -RR            synonymous for -next
  70.    -ROundrobin    synonymous for -next
  71.    -PUshdir       push current dir into environment variable DCD_Push
  72.    -POpdir        jump to directory set by DCD_Push
  73.    -LIst <file>   use alternate directory listing from <file>; full qualified
  74.                   path name must be given for <file>
  75.    -LST           synonymous for -list
  76.    -Scan          scan <drives> and exit program
  77.         <drives>  one or more drive letters separated by whatever you want, or
  78.                   not separated at all; all drives must be accessible or in use
  79.    -REscan        as -scan; however, data in DCD.LST will be retained and
  80.                   scanned drives will be refreshed
  81.    -Partialmatch  require partial match of directory name (default)
  82.    -Fullmatch     require full match of directory name
  83.    -UPpercase     directory search not case sensitive, i.e., [dir] converts to
  84.                   uppercase (default)
  85.    -LOWercase     directory search case sensitive (e.g., dcd foo will not
  86.                   match a directory named FOO). Note that drive letters should
  87.                   be entered as uppercase characters
  88.    -/             convert \ in [dir] to /
  89.    -\             convert / in [dir] to \
  90.    --             do not convert \ or / (default)
  91.    -Expression    search for <dir>, useful if <dir> begins with -.
  92.    -NOGREP        do not use grep for wildcard matching.
  93.    -REGEX         force grep with <dir> as regular expression.
  94.    -GREPOpt <opt> pass <opt> to grep command (multiple -grepopt concatenate).
  95.    -COLOR         attempt to color your world...
  96.    -Version       display version number 
  97.  
  98. By default, DCD will try to match a directory on the current disk, if no drive
  99. is specified in  the  input.  If multiple matches  exist,   the user  will  be
  100. prompted for her/his/its choice.   If one or more  full matches are found, one
  101. may  hit the enter  key to switch to  the suggested directory.  Another choice
  102. may be `Esc',  which exits  the program without  further action.   The maximum
  103. number of choices is  limited to 36 (0-9,A-Z) or  one less than the  number of
  104. rows on the screen, whatever is smaller.  If the  maximum number of choices is
  105. exceeded, DCD will  issue warning messages, but these  will most likely scroll
  106. off  your screen.  Anyway, if so  many possibilities exist, you should specify
  107. your directory more precise,   or use the -next mode.    If no match to   your
  108. directory is found in  the list, an attempt to   switch to the  directory (and
  109. drive) directly will  be made.  Finally, if all  fails a suggestion  to rescan
  110. your disk drives is made.
  111.  
  112. Examples: 
  113.  
  114.    dcd foo             change to *foo* on current drive, prompt if necessary 
  115.    dcd -g foo          change to *foo* on all drives, prompt if necessary 
  116.    dcd -f foo          change to foo (and only foo) on current drive, prompt 
  117.    dcd -n foo          change to next *foo* on current drive, do not prompt 
  118.    dcd -n -g foo       change to next *foo* on all drives, do not prompt 
  119.    dcd -n d:foo        change to next *foo* on drive d:, do not prompt 
  120.    dcd -g d:foo        change to *foo* on drive d:, global setting overridden 
  121.    dcd -\ foo/bar      similar to dcd foo\bar 
  122.    dcd -e -dir-        change to *-dir-* 
  123.    dcd -s c:D:e;f.ghi  scan drives c: d: e: f: g: h: i: 
  124.    dcd -re fg          scan and update drives f: and g: 
  125.  
  126.  
  127. REGULAR EXPRESSIONS. 
  128.  
  129. For those who think that  DCD's mechanism of finding  directories is not smart
  130. enough,    a regular expression search   is  implemented as  well.  By default
  131. GREP.EXE will be  called if the  <dir> string contains the wildcard characters
  132. `?' or `*'.  Before calling GREP, the <dir> string will be translated to mimic
  133. OS/2's wildcard  handling mechanism   for   GNU-grep.  This behavior   can  be
  134. disabled by using  the -regex option.  This  option forces the usage of  grep,
  135. and passes the <dir> string untranslated.  This may  be useful if one wants to
  136. use other flavors  of grep than  GNU's version (hint:  `set dcd=-regex' if you
  137. want to use grep  exclusively for matching  directory  names).  If you  do not
  138. have grep.exe on your system, the -nogrep option will disable grep.  Instead a
  139. single drive will be scanned,  which is quite a kludge,  so I cannot recommend
  140. this.   (This is  because  I do  not feel like  writing  the  code for regular
  141. expression matching when it already exists.)  Options may be passed to grep by
  142. using -grepopt <option>.  The  string passed to grep on  repeated use of  this
  143. option contains the concatenated <option1> <option2> etc. 
  144.  
  145. Examples: 
  146.  
  147.    dcd foo*bar           change to dir ending on bar and containing foo 
  148.    dcd -regex foo.*bar$  as above for GNU grep 
  149.    dcd -nogrep foo?bar   scan local drive and find directory *\foo?bar 
  150.                          (i.e., directory names starts with foo, ends with 
  151.                          bar, with one letter in between). 
  152.  
  153.  
  154. CONFIGURATION. 
  155.  
  156. If you are not satisfied with the  default settings (-local -select -uppercase
  157. -partialmatch  --), then you want to  consider setting an environment variable
  158. which name is the file name of the command  file without extension (e.g., 'set
  159. DCD=-\' for  d:\usr\bin\dcd.cmd and 'set   GCD=-global -\' for c:\gcd.cmd)  or
  160. change  the DCD.Startup string near  the beginning of  the  command file.  The
  161. command line input overrides the setting of the environment variable, which on
  162. its  turn overrides the DCD.Startup string.   Only options should be passed to
  163. DCD this way. 
  164.  
  165. For comments, improvements, bug  fixes, or aob, feel  free to send  e-mail to:
  166. Roger de Reus (reus@mic.dtu.dk).
  167.  
  168. ==============================================================================
  169. Acknowledgements: 
  170. Thanks to J.R. Séguin (cd897@freenet.carleton.ca) for minor changes and
  171. implementing a real rescan option. 
  172.  
  173. ==============================================================================
  174. Known bugs:
  175. - REXX SysFileTree chokes on AFS mounted drives (.Yesterday/.Yesterday) (MOT)
  176.   This means that DCD -scan fails on these drives. REMEDY: since the file 
  177.   containing the directory structure is human readable and contains just one 
  178.   directory entry on each line, it is straightforward to construct this file, 
  179.   either by manually editing or by writing your own code to scan AFS mounted 
  180.   drives. 
  181.   This bug (try dir /s :-) was reported before FixPack17 for Warp v3 was 
  182.   released.
  183. - No corrections are made (and ever  will be) for displayed lines which are 
  184.   longer than the width of the screen.
  185.  
  186. ==============================================================================
  187. Improvements I can think of (any comments/volunteers?): 
  188. - None at the moment. To my feeling the code became so extensive and usage so
  189.   flexible (and loading on my old PC so slow) that I do not feel the need to 
  190.   enlarge the program any further.
  191. - Well, maybe use temporary files instead of REXX queue for grep operations?
  192. - Well, maybe a stack for multiple push/pop operations?
  193. - Porting to other OS's (or just rewrite the whole thing in ANSI C)? 
  194.  
  195. ==============================================================================
  196. History: 
  197. 11Aug97: v2.00 released 
  198. 25Jun97: v2.00b6 
  199.          allow switching to existing dir on non-scanned drives
  200. 17Apr97: v2.00b5 
  201.          added -pushdir and -popdir (using DCD_PUSH environment variable)
  202. 05Feb97: v2.00b4 
  203.          display DCD Errors always on new line 
  204. 17Dec96: v2.00b3 
  205.          fixed rescan to avoid double drives (bug introduced by me:-) 
  206.         display real dir names instead of upcase for -upper 
  207.         replaced -$debug option by -$trace option to set trace level 
  208.          use default queue instead of DCDQ for grep operations
  209. Endof96: v2.00b2
  210.          adapt dcd.doc to new changes
  211.          wrong translation of * (\* --> .*) for grep
  212.          added -$debug option, just in case...
  213. Endof96: v2.00b1
  214.          add -<n> option to go <n> times `up' in the directory tree
  215.          add -expression option (could enter extra space as well...)
  216.          fixed bug in Test_Dots (Dir -> DCD.Dir)
  217.          add color option (requires ansi on)
  218.         input allowed after (re)scan (dcd -rescan c newdir)
  219.          strict sort of drives before scanning
  220.          Modifications by J. R. Séguin (cd897@freenet.carleton.ca)
  221.           - drives are validated against accessed drive list
  222.           - implemented rescan merge into prior DCD.LST
  223.          enlarge uppercase to entire cp850
  224.          added (limited) wildcard support
  225.          do not verify drive on grep -regex?
  226.          do not strip leading blanks from input (so, separator is *1* blank)
  227.         display allowed abbreviations in uppercase (-help)
  228.          adapt help to new changes
  229.          add more wildcard support through grep
  230.          bold face help abbreviations
  231. 24Apr96: v1.05; added -LIST option; prompt for missing input
  232. 06Jan96: v1.04; usage of environment variable to configure startup behavior
  233.          added DCD.Startup to configure startup behavior more transparent
  234. 25Sep95: v1.03; added -LOWercase and -UPpercase options
  235. 20Sep95: v1.02; added -\, -/, and -- options
  236. 19Sep95: v1.01; allow forward slashes in directory names
  237. 15Sep95: change version to 1.00; submit to hobbes.nmsu.edu and ftp.leo.org
  238. 28Aug95: DCD_Scan use SysFileTree(Drive'\') iso SysFileTree(Drive'\*')
  239.          say if CmdLin ignored
  240. 23Aug95: t\o matched t\okay, but also subdirectories with o (t\okay\oops)
  241.          bag out after displaying version
  242.          separate error messages if no (full) match
  243. 09Aug95  decided we are at beta test level
  244. 08Aug95: echo user input
  245. 18Jul95: proposal best match wrong (if then if else if --> added do; end)
  246. 17Jul95: alpha  version  v0.1
  247. =============================== end of DCD.DOC ===============================
  248.